package com.tedu.ivos.geofence.controller;

import com.tedu.ivos.base.response.JsonResult;
import com.tedu.ivos.geofence.pojo.dto.GeofenceParam;
import com.tedu.ivos.geofence.pojo.dto.GeofenceQuery;
import com.tedu.ivos.geofence.service.IGeofenceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/v1/geofence")
public class GeofenceController {

    @Autowired
    IGeofenceService iGeofenceService;

    @GetMapping("select")
    public JsonResult select(GeofenceQuery geofenceQuery){
        log.debug("查询电子围栏，参数：{}",geofenceQuery);
        return JsonResult.ok(iGeofenceService.select(geofenceQuery));
    }
    @PostMapping("save")
    public JsonResult saveGeofence(GeofenceParam geofenceParam){
        log.debug("保存电子围栏，参数：{}",geofenceParam);
        iGeofenceService.saveGeofence(geofenceParam);
        return JsonResult.ok();

    }
    @PostMapping("delete")
    public JsonResult deleteGeofence(Long id){
        log.debug("删除电子围栏，参数：{}",id);
        iGeofenceService.deleteGeofence(id);
        return JsonResult.ok();
    }

}
